package com.hugang.aboutinterface;

/**
 * @author hg
 * @date 2020/6/13 15:11
 */
public class Test2 {
}

interface A1 {
    void play();
}

interface A2 {
    void play();
}

interface B1 extends A1, A2 {
    Ball ball = new Ball("pingpang");
}

class Ball implements B1 {

    private String name;

    Ball(String name) {
        this.name = name;
    }

    /**
     * 此方法重写，既算重写了A1的play，也算重写了A2的play
     */
    @Override
    public void play() {
        //此ball在B1接口中已定义，为final static变量，因此不可重新赋值
//        ball = new Ball("篮球");
        ball.play();
    }

    public String getName() {
        return name;
    }
}
